From: Brion Vibber Date: Wed, 3 Dec 2003 00:42:31 +0000 (+0000) Subject: Armor against bad titles X-Git-Tag: 1.1.0~31 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/%22%24ccApp/%28%5B%5E/%7B%24admin_url%7Dcompta/comptes/%27%40url%40/%7B%7B%20url_for%28%27login%27%29%20%7D%7D?a=commitdiff_plain;h=5816c312fbdf6c01ba1de37c77f67b02e2077b60;p=lhc%2Fweb%2Fwiklou.git Armor against bad titles --- diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index 03978bea04..87771384c2 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -3,26 +3,30 @@ class SearchUpdate { - /* private */ var $mId, $mNamespace, $mTitle, $mText; + /* private */ var $mId = 0, $mNamespace, $mTitle, $mText; /* private */ var $mTitleWords; function SearchUpdate( $id, $title, $text = false ) { - $this->mId = $id; - $this->mText = $text; - $nt = Title::newFromText( $title ); - $this->mNamespace = $nt->getNamespace(); - $this->mTitle = $nt->getText(); # Discard namespace + if( $nt ) { + $this->mId = $id; + $this->mText = $text; + + $this->mNamespace = $nt->getNamespace(); + $this->mTitle = $nt->getText(); # Discard namespace - $this->mTitleWords = $this->mTextWords = array(); + $this->mTitleWords = $this->mTextWords = array(); + } else { + wfDebug( "SearchUpdate object created with invalid title '$title'\n" ); + } } function doUpdate() { global $wgDBminWordLen, $wgLang, $wgDisableSearchUpdate; - if( $wgDisableSearchUpdate ) { + if( $wgDisableSearchUpdate || !$this->mId ) { return false; } $lc = SearchEngine::legalSearchChars() . "&#;";